home *** CD-ROM | disk | FTP | other *** search
- Path: li.net!jeremy
- From: jeremy@newshost.li.net (Jeremy Markman)
- Newsgroups: comp.lang.c
- Subject: Re: Newbie needs help w/ARGV ARGC
- Date: 25 Mar 1996 20:06:28 GMT
- Organization: LI Net (Long Island Network)
- Message-ID: <4j6uc4$ehf@linet06.li.net>
- References: <4j4ja1$dc3@mtinsc01-mgt.ops.worldnet.att.net>
- NNTP-Posting-Host: linet04.li.net
- X-Newsreader: TIN [version 1.2 PL2]
-
- Raymond Joh (dslayer@worldnet.att.net) wrote:
- : I have spent three days attempting to determine why my command line
- : arguments are failing...
-
- You don't need to use the gets() function. The values of argv[][] are
- already initialized when the program runs.
-
- For example:
-
- void main(int argc, char *argv[])
- {
- if (argc > 1)
- printf("%s\n",argv[1]);
- }
-
- This will print the first command line argument. Remember that the
- program itself is the first argument, so that argc == 1 when no
- additional parameters are added. Accordingly, argv[0] is the name of the
- program and argv[1] is the FIRST command line argument...
-